/*
Copyright [2020] [https://www.xiaonuo.vip]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

XiaoNuo采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：

1.请不要删除和修改根目录下的LICENSE文件。
2.请不要删除和修改XiaoNuo源码头部的版权声明。
3.请保留源码和相关描述文件的项目出处，作者声明等。
4.分发源码时候，请注明软件出处 https://gitee.com/xiaonuobase/xiaonuo-vue
5.在修改包名，模块名称，项目代码等时，请注明软件出处 https://gitee.com/xiaonuobase/xiaonuo-vue
6.若您的项目无法满足以上几点，可申请商业授权，获取XiaoNuo商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package com.cn.xiaonuo.slbfinances.attractinfo.controller;

import com.cn.xiaonuo.common.entity.BusinessMessage;
import com.cn.xiaonuo.core.annotion.BusinessLog;
import com.cn.xiaonuo.core.annotion.Permission;
import com.cn.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import com.cn.xiaonuo.core.pojo.response.ResponseData;
import com.cn.xiaonuo.core.pojo.response.SuccessResponseData;
import com.cn.xiaonuo.slbfinances.attractinfo.param.SlAttractUserParam;
import com.cn.xiaonuo.slbfinances.attractinfo.service.SlAttractUserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * 招商控制器
 *
 * @author luyangyang
 * @date 2022-03-08 09:13:31
 */
@RestController
public class SlAttractUserController {

    @Resource
    private SlAttractUserService slAttractUserService;

    /**
     * 查询招商
     *
     * @author luyangyang
     * @date 2022-03-08 09:13:31
     */
    @ApiOperation(value = "招商列表", notes = "招商列表")
    @PostMapping("/api/slAttractUser/page")
    @BusinessLog(title = "招商_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(SlAttractUserParam SlAttractUserParam) {
        return new SuccessResponseData(slAttractUserService.page(SlAttractUserParam));
    }

    /**
     * 添加招商
     *
     * @author luyangyang
     * @date 2022-03-08 09:13:31
     */
    @Permission
    @PostMapping("/api/slAttractUser/add")
    @BusinessLog(title = "招商_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody  SlAttractUserParam SlAttractUserParam) {
        slAttractUserService.add(SlAttractUserParam);
        return new SuccessResponseData();
    }

    /**
     * 删除招商
     *
     * @author luyangyang
     * @date 2022-03-08 09:13:31
     */
    @Permission
    @PostMapping("/api/slAttractUser/delete")
    @BusinessLog(title = "招商_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody SlAttractUserParam SlAttractUserParam) {
        slAttractUserService.delete(SlAttractUserParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑招商
     *
     * @author luyangyang
     * @date 2022-03-08 09:13:31
     */
    @Permission
    @PostMapping("/api/slAttractUser/edit")
    @BusinessLog(title = "招商_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody SlAttractUserParam SlAttractUserParam) {
        slAttractUserService.edit(SlAttractUserParam);
        return new SuccessResponseData();
    }

    /**
     * 查看招商
     *
     * @author luyangyang
     * @date 2022-03-08 09:13:31
     */
    @Permission
    @PostMapping("/api/slAttractUser/detail")
    @BusinessLog(title = "招商_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(SlAttractUserParam SlAttractUserParam) {
        return new SuccessResponseData(slAttractUserService.detail(SlAttractUserParam));
    }

    /**
     * 导出系统用户
     *
     * @author luyangyang
     * @date 2022-03-08 09:13:31
     */
    @ApiOperation(value = "招商列表导出", notes = "招商列表导出")
    @GetMapping("/api/slAttractUser/export")
    @BusinessLog(title = "系统用户_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
    public void export(HttpServletResponse response, SlAttractUserParam slAttractUserParam) throws Exception {
         slAttractUserService.export(response,slAttractUserParam);
    }

    @ApiOperation(value = "批量确认", notes = "批量确认")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "idList", value = "支付订单ID列表", example = "[10086,10028]", required = true),
            @ApiImplicitParam(name = "userId", value = "用戶ID", example = "10086", required = true)
    })
    @RequestMapping(value ="/api/slAttractUser/batchOk", method = RequestMethod.POST)
    public BusinessMessage batchOk(SlAttractUserParam slAttractUserParam) {
        return slAttractUserService.batchOk(slAttractUserParam);
    }
}
